package com.fp.m7.manager;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.fp.m7.api.manager.FollowManager;
import com.fp.m7.api.model.Account;
import com.fp.m7.dao.AccountDao;

public class FollowManagerImpl implements FollowManager {

	@Autowired
	private AccountDao accountDao;

	@Override
	public void follow(Account follower, Account followed) {
		accountDao.follow((com.fp.m7.model.Account) follower,
				(com.fp.m7.model.Account) followed);
	}

	@Override
	public void unfollow(Account follower, Account followed) {
		accountDao.unfollow((com.fp.m7.model.Account) follower,
				(com.fp.m7.model.Account) followed);
	}

	@Override
	public boolean isFollowing(Account user, Account other) {
		return accountDao.isFollowing((com.fp.m7.model.Account) user,
				(com.fp.m7.model.Account) other);
	}

	@Override
	public boolean isFollowedBy(Account user, Account other) {
		return accountDao.isFollowedBy((com.fp.m7.model.Account) user,
				(com.fp.m7.model.Account) other);
	}

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@Override
	public List<Account> getFollowersForUser(Account user) {
		List found = accountDao
				.getFollowersForUser((com.fp.m7.model.Account) user);
		return found;
	}

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@Override
	public List<Account> getFollowedByUser(Account user) {
		List found = accountDao
				.getFollowedByUser((com.fp.m7.model.Account) user);
		return found;
	}

	@Override
	public int countActiveFollowers(Account followed) {
		return accountDao
				.countActiveFollowers((com.fp.m7.model.Account) followed);
	}

	@Override
	public int countActivelyFollowed(Account follower) {
		return accountDao
				.countActivelyFollowed((com.fp.m7.model.Account) follower);
	}

}